package com.chen.script.config;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.io.File;

/**
 * @author ChenJinLong
 */
@Slf4j
@Data
@Component
public class CommonProperties {

    /** 临时文件目录 */
    @Value("${temp-file-dir:D:\\java-temp}")
    private String tempFileDir;

    @PostConstruct
    public void createTempFileDir(){
        File file = new File(tempFileDir);
        if (!file.exists()){
            if (file.mkdir()){
                log.info("创建临时文件目录: {}", tempFileDir);
            }
        }
    }
}
